export const Layout = () => import("@/layout/index.vue");
import { RouteRecordRaw } from "vue-router";
//登录、重定向
export const whiteList: RouteRecordRaw[] = [
  {
    path: "/redirect",
    component: Layout,
    meta: { hidden: true },
    children: [
      {
        path: "/redirect/:path(.*)",
        component: () => import("@/views/redirect/index.vue"),
      },
    ],
  },

  {
    path: "/login",
    component: () => import("@/views/login/index.vue"),
    meta: { hidden: true },
  },
];

//首页
export const homeList: RouteRecordRaw[] = [
  {
    path: "/",
    name: "/",
    component: Layout,
    redirect: "/home",
    children: [
      {
        path: "home",
        component: () => import("@/views/dashboard/index.vue"),
        name: "home", // 用于 keep-alive, 必须与SFC自动推导或者显示声明的组件name一致
        // https://cn.vuejs.org/guide/built-ins/keep-alive.html#include-exclude
        meta: {
          title: "home",
          icon: "homepage",
          affix: true,
          keepAlive: true,
          alwaysShow: false,
        },
      },
      {
        path: "401",
        component: () => import("@/views/error-page/401.vue"),
        meta: { hidden: true },
      },
      {
        path: "404",
        component: () => import("@/views/error-page/404.vue"),
        meta: { hidden: true },
      },
    ],
  },
];

//用户中心
export const userList: RouteRecordRaw[] = [
  {
    path: "/user",
    component: Layout,
    redirect: "/user/index",
    meta: {
      title: "用户管理",
      icon: "user",
      hidden: false,
      roles: ["ADMIN"],
      keepAlive: true,
    },
    children: [
      {
        path: "/user/index",
        component: () => import("@/views/user/index.vue"),
        name: "MEMBER",
        meta: {
          title: "会员管理",
          icon: "role",
          hidden: false,
          roles: ["ADMIN"],
          keepAlive: true,
        },
      },
      {
        path: "/user/farmers",
        component: () => import("@/views/user/farmers.vue"),
        name: "FAMERS",
        meta: {
          title: "农场主",
          icon: "role",
          hidden: false,
          roles: ["ADMIN"],
          keepAlive: true,
        },
      },

      {
        path: "/user/carry",
        component: () => import("@/views/user/carry.vue"),
        name: "CARRY",
        meta: {
          title: "排行榜",
          icon: "role",
          hidden: false,
          roles: ["ADMIN"],
          keepAlive: true,
        },
      },
    ],
  },
];

//公告管理
export const noticeList: RouteRecordRaw[] = [
  {
    path: "/notice",
    component: Layout,
    redirect: "/notice/index",
    meta: {
      title: "公告管理",
      icon: "user",
      hidden: false,
      roles: ["NOTICE"],
      keepAlive: true,
    },
    children: [
      {
        path: "/notice/index",
        component: () => import("@/views/notice/index.vue"),
        name: "NOTICE",
        meta: {
          title: "公告管理",
          icon: "role",
          hidden: false,
          roles: ["NOTICE"],
          keepAlive: true,
        },
      },
    ],
  },
];

//商超
export const shopList: RouteRecordRaw[] = [
  {
    path: "/shop",
    component: Layout,
    redirect: "/shop/package/index",
    meta: {
      title: "商超",
      icon: "role",
      hidden: false,
      roles: ["ADMIN"],
      keepAlive: true,
    },
    children: [
      {
        path: "/shop/package/index",
        component: () => import("@/views/shop/package/index.vue"),
        name: "PACKAGE",
        meta: {
          title: "套餐",
          icon: "role",
          hidden: false,
          roles: ["NOTICE"],
          keepAlive: true,
        },
      },
      {
        path: "/shop/variety/index",
        component: () => import("@/views/shop/variety/index.vue"),
        name: "VARIETY",
        meta: {
          title: "品种列表",
          icon: "role",
          hidden: false,
          roles: ["NOTICE"],
          keepAlive: true,
        },
      },
    ],
  },
];

//屠宰场
export const spaceList: RouteRecordRaw[] = [
  {
    path: "/space",
    component: Layout,
    redirect: "/space/filed/index",
    meta: {
      title: "屠宰场",
      icon: "role",
      hidden: false,
      roles: ["ADMIN"],
      keepAlive: true,
    },
    children: [
      {
        path: "/space/filed/index",
        component: () => import("@/views/space/filed/index.vue"),
        name: "SPACE",
        meta: {
          title: "场地管理",
          icon: "role",
          hidden: false,
          roles: ["NOTICE"],
          keepAlive: true,
        },
      },
      {
        path: "/space/slaughter/index",
        component: () => import("@/views/space/slaughter/index.vue"),
        name: "SLAUGHTER",
        meta: {
          title: "宰杀管理",
          icon: "role",
          hidden: false,
          roles: ["NOTICE"],
          keepAlive: true,
        },
      },
    ],
  },
];

//系统管理
export const systemList: RouteRecordRaw[] = [
  {
    path: "/system",
    component: Layout,
    redirect: "/system/user",
    meta: {
      title: "系统管理",
      icon: "system",
      hidden: false,
      roles: ["ADMIN"],
      keepAlive: true,
    },
    children: [
      {
        path: "role",
        component: () => import("@/views/system/role/index.vue"),
        name: "Role",
        meta: {
          title: "角色管理",
          icon: "role",
          hidden: false,
          roles: ["ADMIN"],
          keepAlive: true,
        },
      },
      {
        path: "menu",
        component: () => import("@/views/system/menu/index.vue"),
        name: "Menu",
        meta: {
          title: "菜单管理",
          icon: "menu",
          hidden: false,
          roles: ["ADMIN"],
          keepAlive: true,
        },
      },
      {
        path: "dept",
        component: () => import("@/views/system/dept/index.vue"),
        name: "Dept",
        meta: {
          title: "部门管理",
          icon: "tree",
          hidden: false,
          roles: ["ADMIN"],
          keepAlive: true,
        },
      },
      {
        path: "dict",
        component: () => import("@/views/system/dict/index.vue"),
        name: "DictType",
        meta: {
          title: "字典管理",
          icon: "dict",
          hidden: false,
          roles: ["ADMIN"],
          keepAlive: true,
        },
      },
    ],
  },
];
